package com.openget.lang;
import java.util.*;
import java.util.concurrent.*;
import com.openget.lang.*;

public class OpengetContext {
	
	public IInfrastructure Infrastructure;
	public IProcessor Processor;
	private OpengetContext parent;	
	private Hashtable<String, Object> running;
	private Hashtable<String, Object> trapped;
	private byte[] content;
	
    public Hashtable<String, Object> getRunning() {
        return this.running;
    }
	
    public Hashtable<String, Object> getTrapped() {
        return this.trapped;
    }
	
    public byte[] getContent() {
        return this.content;
    }
	
	public OpengetContext(OpengetContext parent, byte[] content) {		
		this.parent = parent;
		this.content = content;
	}
	
	private OpengetContext(IInfrastructure infrastructure, IProcessor processor) {
		this.Infrastructure = infrastructure;
		this.Processor = processor;
	}
	
	public static OpengetContext createInstance(IInfrastructure infrastructure, IProcessor processor) {		
		return new OpengetContext(infrastructure, processor);
	}
	
	public void recycled() {
		this.parent.getTrapped().putAll(this.trapped);
		this.parent.recycled();
		this.trapped = null;
	}
}
